﻿/*
 * SimpleSocket.h
 *
 */
#ifndef __GDK_SIMPLESOCKET_H__
#define __GDK_SIMPLESOCKET_H__

#include <gdk/core/Types.h>
#include <gdk/core/String.h>
#include <gdk/core/IO.h>
#include <gdk/net/Socket.h>


namespace gdk
{

	class GDK_NET_EXPORT SimpleSocket : public Socket, public IO
	{
		DECLARE_CLASS_HANDLE(SimpleSocket)
		DECLARE_CLASS_INSTANCE(SimpleSocket)

	protected:
		SimpleSocket(void);

	public:
		virtual bool connect(const Char *hostname, uint16_t port);
		virtual bool attach(SOCKET s);
		virtual ssize_t available(void) const;
		virtual ssize_t read(void *buf, ssize_t len);
		virtual ssize_t peek(void *buf, ssize_t len) const;
		virtual ssize_t write(const void *buf, ssize_t len);
	};


}//namespace gdk

#endif /* __GDK_SIMPLESOCKET_H__ */
